package com.cskaoyan.bean.promotion.coupon;

import com.cskaoyan.util.DateUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Description:
 * @Author: WD created on 2021-09-16 22:07
 * @Version:
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CouponUserVO {

    private Integer id;
    private Integer userId;
    private Integer couponId;
    private Short status;
    private String usedTime;
    private String startTime;
    private String endTime;
    private Integer orderId;
    private String addTime;
    private String updateTime;
    private Boolean deleted;

    public CouponUserVO(CouponUser couponUser) {
        this.id = couponUser.getId();
        this.userId = couponUser.getUserId();
        this.couponId = couponUser.getCouponId();
        this.status = couponUser.getStatus();
        if (couponUser.getUsedTime() != null) {
            this.usedTime = DateUtils.dateFormat(couponUser.getUsedTime());
        }

        if (couponUser.getStartTime() != null) {
            this.startTime = DateUtils.dateFormat(couponUser.getStartTime());
        }
        if (couponUser.getEndTime() != null) {
            this.endTime = DateUtils.dateFormat(couponUser.getEndTime());
        }
        if(couponUser.getAddTime()!=null){
            this.addTime = DateUtils.dateFormat(couponUser.getAddTime());
        }

        if(couponUser.getUpdateTime()!=null){
            this.updateTime = DateUtils.dateFormat(couponUser.getUpdateTime());
        }
        this.orderId =couponUser.getOrderId();
        this.deleted = couponUser.getDeleted();


    }
}
